<template>
  <div class="loginInfo">
    <div class="leftImg">
      <el-image style="width: 309px; height: 427px" :src="url" fit="fill" />
    </div>
    <div class="login-panel">
      <h3 class="title">欢迎注册中酒云网</h3>
      <div class="goRigster">已有账号? <a class="primColor">去登录</a></div>
      <div class="tabs">
        <div class="content">
          <div class="phone">
            <panel-account ref="accountRef" />
          </div>
        </div>
      </div>
      <el-row justify="space-between" align="bottom" :gutter="20">
        <el-col :span="24">
          <el-button class="login-btn" type="primary" size="large" @click="handleLoginBtnClick()">
            立即登录
          </el-button>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, watch } from 'vue'
import { getAssetURL } from '@/utils/load_assets'
import { localCache } from '@/utils/cache'
import PanelAccount from './panel-account.vue' //单位注册

const url = getAssetURL('login/leftCover.png')
const accountRef = ref()

const isRemPwd = ref<boolean>(localCache.getCache('isRemPwd') ?? false) // 是否记住密码

watch(isRemPwd, (newValue) => {
  localCache.setCache('isRemPwd', newValue)
})

const handleLoginBtnClick = () => {
    accountRef?.value.loginAction(isRemPwd.value)
}
</script>

<style lang="less" scoped>
.loginInfo {
  display: flex;
  align-items: flex-end;
  transform: translate(50%);
}

.login-panel {
  width: 416px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.8);
  margin-top: 40px;

  .top {
    .el-row {
      width: 100%;

      .el-button {
        width: 100%;
      }

      .activeBtn {
        width: 100%;
        color: #4098FF;
        border-radius: 5px;
        border: 1px solid #4098FF;
        background: rgba(64, 152, 255, 0.10);
        box-shadow: 0px 0px 0px 1px rgba(64, 152, 255, 0.20);
      }

      .primaryBtn {
        width: 100%;
        border-radius: 5px;
        border: 1px solid #D9D9D9;
        color: #B2B2B2;
        background: rgba(255, 255, 255, 0.3);
      }
    }
  }

  .title {
    text-align: left;
    margin-bottom: 15px;
  }

  .goRigster {
    margin-bottom: 20px;
    cursor: pointer;
  }

  .icon {
    display: flex;
    align-items: center;
    justify-content: center;

    .text {
      margin-left: 5px;
    }
  }

  .controls {
    display: flex;
    margin-top: 12px;

    justify-content: space-between;
  }

  .login-btn {
    margin-top: 10px;
    width: 100%;
  }

  .login-btn1 {
    border: 0.5px solid #4098FF;
    background: #FFF;
    width: 100%;
    color: #4098FF;
  }

  .tips {
    margin: 20px;
    text-align: center;
    color: #B2B2B2;
  }
}
</style>
